import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
// setup 语法糖扩展写法插件 <script setup name="" lang="ts"></script>
import vueSetupExtend from 'vite-plugin-vue-setup-extend'
import {resolve} from 'path'


// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        vueSetupExtend(),
    ],
    server: {
        // 自定义主机 IP
        host: 'localhost',
        // 自定义端口
        port: 8001,
        proxy: {
            '/api': {
                target: 'http://localhost:8080',
                changeOrigin: true,
                rewrite: (path: string) => path.replace(/^\/api/, '')
            }
        }
    },
    resolve: {
        alias: {
            '@': resolve(__dirname, './src')
        }
    },

})
